#ifndef JNIPP_HPP
#define JNIPP_HPP

//TODO: ver
//	http://en.wikipedia.org/wiki/Java_Native_Interface#Mapping_types

#include <string>
#include <jni.h>

namespace jnipp
{

//Type mapping

inline bool from_java(JNIEnv * const, jboolean b)
{
    return b == JNI_TRUE;
}

inline signed char from_java(JNIEnv * const, jbyte b)
{
    return b;
}

inline unsigned short from_java(JNIEnv * const, jchar c)
{
    return c;
}

inline short from_java(JNIEnv * const, jshort s)
{
    return s;
}

inline long from_java(JNIEnv * const, jint i)
{
    return i;
}

inline long long from_java(JNIEnv * const, jlong l)
{
    return l;
}

inline float from_java(JNIEnv * const, jfloat f)
{
    return f;
}

inline double from_java(JNIEnv * const, jdouble d)
{
    return d;
}




inline std::string from_java(JNIEnv * const env, jstring s)
{
    const char * const c_s( env->GetStringUTFChars(s, 0) );
    std::string result(c_s);
    env->ReleaseStringUTFChars(s, c_s);
    return result;
}




inline jstring to_java(JNIEnv * const env, std::string const& s)
{
    return env->NewStringUTF( s.c_str() );
}

//TODO: complete the rest of the to_java functions

}


#include "jni_function.hpp"

#endif // JNIPP_HPP
